﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:local="clr-namespace:ClearbrookStudios.Controls"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="local:PanningTile">
        <Style.Setters>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="local:PanningTile">
                        <Canvas x:Name="PanningCanvas">
                            <Canvas.Resources>
                                <Storyboard x:Name="Left">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
                                                                   Storyboard.TargetName="TileImage">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                              Value="0">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                        <EasingDoubleKeyFrame KeyTime="0:0:10"
                                                              Value="1">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                                <Storyboard x:Name="Right">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
                                                                   Storyboard.TargetName="TileImage">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                              Value="1">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                        <EasingDoubleKeyFrame KeyTime="0:0:10"
                                                              Value="0">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                                <Storyboard x:Name="Down">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                                                   Storyboard.TargetName="TileImage">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                              Value="0">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                        <EasingDoubleKeyFrame KeyTime="0:0:10"
                                                              Value="1">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                                <Storyboard x:Name="Up">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                                                   Storyboard.TargetName="TileImage">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                              Value="1">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                        <EasingDoubleKeyFrame KeyTime="0:0:10"
                                                              Value="0">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <QuarticEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                                <Storyboard x:Name="ZoomOut">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)"
                                                                   Storyboard.TargetName="TileImage">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                              Value="1" />
                                        <EasingDoubleKeyFrame KeyTime="0:0:5"
                                                              Value="0.3">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <CircleEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"
                                                                   Storyboard.TargetName="TileImage">
                                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                                              Value="1" />
                                        <EasingDoubleKeyFrame KeyTime="0:0:5"
                                                              Value="0.3">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <CircleEase EasingMode="EaseOut" />
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>

                            </Canvas.Resources>
                            <Canvas.Clip>
                                <RectangleGeometry Rect="0,0,173,173" />
                            </Canvas.Clip>
                            
                            <Image Name="TileImage"
                                   Source="{TemplateBinding ImageSource}"
                                   Height="256"
                                   Width="256"
                                   Stretch="UniformToFill">
                                <UIElement.RenderTransform>
                                    <CompositeTransform />
                                </UIElement.RenderTransform>
                            </Image>
                        </Canvas>

                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style.Setters>
    </Style>
</ResourceDictionary>